<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input class="inp" type="text">
    <button class="btn">输入是否下雨</button>
    <script>
    var btn = document.getElementsByClassName("btn")[0];
    var inp = document.getElementsByClassName("inp")[0];
    btn.onclick=function(){
        var res = inp.value;
        if(res=="下雨了"){
            console.log("宝贝带伞")
        }
        else{
            console.log("滚")
        }
    }
    </script>
</body>
</html>